export const formConfig = {
	inline: false,
	showBtn: true,
	labelPosition: 'top',
	labelWidth: '120px',
	column: [
		{
			label: '任务名称',
			prop: 'taskName',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 12,
			rules: [{ required: true, message: '请输入任务名称' }],
		},
		{
			label: '隐患评估表',
			prop: 'tableTemplateId',
			propName: 'tableTemplateName',
			type: 'autoSelect',
			api: 'view_tableTemplate_page',
			filterKey: 'id',
			filterLabel: 'templateName',
			multiple: false,
			paramsObj: {
				type: 6,
			},
			rules: [{ required: true, message: '请输入隐患评估表' }],
			span: 12,
		},

		{
			label: '有效开始时间',
			prop: 'effectiveStartTime',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			type: 'date',
			span: 12,
			rules: [{ required: true, message: '请选择有效开始时间' }],
		},
		{
			label: '有效结束时间',
			prop: 'effectiveEndTime',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			type: 'date',
			span: 12,
			rules: [{ required: true, message: '请选择有效结束时间' }],
		},
		{
			label: '状态',
			prop: 'status',
			type: 'select',
			defaultValue: 0,
			dicData: [
				{
					label: '开启',
					value: 0,
					type: 'success',
				},
				{
					label: '关闭',
					value: 1,
					type: 'danger',
				},
			],
			rules: [{ required: true, message: '请选择状态' }],
			span: 12,
		},
		{
			label: '评估第三方',
			prop: 'evaluateThirdPartiesCreditCode',
			propName: 'evaluateThirdParties',
			type: 'autoSelect',
			api: 'view_dpServiceProvider_page',
			filterKey: 'creditCode',
			filterLabel: 'providerName',
			multiple: false,
			changeField: true,
			viewDisplay: false,
			rules: [{ required: true, message: '请输入评估第三方' }],
			change: (item, form) => {
				form.evaluateThirdPartiesId = item.id
			},
			span: 12,
		},
		{
			label: '被评估对象',
			prop: 'assessedOrganization',
			propName: 'assessedOrganizationName',
			type: 'remoteSelect',
			api: 'view_dpServiceOrgBase_page',
			filterKey: 'creditCode',
			filterLabel: 'organizationName',
			multiple: true,
			labelPosition: 'left',
			// rules: [{ required: true, message: '请输入被评估的机构' }],
			span: 24,
		},
	],
}

export const searchConfig = {
	inline: true,
	showBtn: true,
	labelPosition: 'left',
	labelWidth: '90px',
	column: [
		{
			label: '发布时间',
			prop: 'releaseTimeBetween',
			valueFormat: 'YYYY-MM-DD HH:mm:ss',
			type: 'dateBetween',
			span: 8,
		},
		{
			label: '任务名称',
			prop: 'taskName',
			type: 'text',
			span: 8,
		},
		{
			label: '状态',
			prop: 'status',
			type: 'select',
			dicData: [
				{
					label: '开启',
					value: 0,
				},
				{
					label: '关闭',
					value: 1,
				},
			],
			span: 8,
		},
		{
			label: '隐患评估表',
			prop: 'tableTemplateId',
			propName: 'tableTemplateName',
			type: 'remoteSelect',
			api: 'view_tableTemplate_page',
			filterKey: 'id',
			filterLabel: 'templateName',
			multiple: false,
			paramsObj: {
				type: 6,
			},
			span: 8,
		},
		{
			label: '评估第三方',
			prop: 'evaluateThirdPartiesCreditCode',
			propName: 'evaluateThirdParties',
			type: 'autoSelect',
			api: 'view_dpServiceProvider_page',
			filterKey: 'creditCode',
			filterLabel: 'providerName',
			multiple: false,
			changeField: true,
			viewDisplay: false,
			span: 8,
		},
		{
			label: '有效时间',
			prop: 'effectiveStartTimeBetween',
			valueFormat: 'YYYY-MM-DD HH:mm:ss',
			type: 'dateBetween',
			span: 8,
		},
	],
}

export const tableConfig = {
	stripe: true,
	border: true,
	columns: [
		{ label: '所属区', prop: 'belongArea' },
		{ label: '发布时间', prop: 'releaseTime' },
		{ label: '任务名称', prop: 'taskName' },
		{ label: '隐患评估表', prop: 'tableTemplateName' },
		{ label: '评估第三方', prop: 'evaluateThirdParties' },
		{ label: '有效时间', prop: 'effectiveTime' },
		{
			label: '状态',
			prop: 'status',
			custome: 'tag',
			dicData: [
				{
					label: '开启',
					value: 0,
					type: 'success',
				},
				{
					label: '关闭',
					value: 1,
					type: 'danger',
				},
			],
		},
		{
			label: '被评估机构个数',
			prop: 'assessedOrganizationNum',
		},
		{
			label: '已完成个数',
			prop: 'completeNum',
		},
		{
			label: '操作',
			prop: 'menu',
			width: 300,
			fixed: 'right',
		},
	],
}

export const api = {
	index: 'view_pbHazardAssessmentTask_page',
	add: 'view_pbHazardAssessmentTask_add',
	edit: 'view_pbHazardAssessmentTask_edit',
	delete: 'view_pbHazardAssessmentTask_del',
}
export const auth = {
	...api,
}
export const baseConfig = {
	pageName: '隐患评估任务',
	dictcodes: [],
	rowKey: 'id',
	addLabel: '发布任务',
	tipLabel: 'taskName',
	exportMqTopic: '/ning/export/',
	api,
	auth,
	menuBtn: [
		{
			icon: 'editor',
			label: '编辑',
			type: 'primary',
			operate: 'edit',
			auth: auth.edit,
			text: true,
			show: true,
		},
		{
			icon: 'delete',
			label: '删除',
			type: 'danger',
			operate: 'delete',
			auth: auth.delete,
			text: true,
			show: true,
			condition: '(row)=>{return row.status==1}',
		},
		{
			icon: 'detail',
			label: '详情',
			type: 'primary',
			operate: 'detail',
			auth: auth.index,
			text: true,
			show: true,
		},
	],
	beforeOnLoadFormate: async (query) => {
		return new Promise((resolve, reject) => {
			resolve(query)
		})
	},
	onLoadFormate: async (arr) => {
		return new Promise((resolve, reject) => {
			resolve(arr)
		})
	},
	dialogConfig: {
		width: '75%',
	},
	searchConfig,
	formConfig,
	tableConfig,
}
